<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\widgets\Alert;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\helpers\Url;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\modules\admin\assets\AdminAsset;

AdminAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta name="referrer" content="never">
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
    <style>
        .wrap > .container {
            padding: 0px 15px 20px;
        }
        .page-header {
            padding-bottom: 9px;
            margin: 20px 0 30px;
            border-bottom: 1px solid #eee;
        }
    </style>
</head>
<body>
<?php $this->beginBody() ?>
<?php echo '<script> var basePath="'.Url::to('@web/member',true).'" </script>'?>
<div class="wrap">
    <?php
    NavBar::begin([
        'brandLabel' => 'XGATE',
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar navbar-default navbar-static-top',
        ],
    ]);
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        'items' => [
            ['label' => '首页', 'url' => ['/admin/default/index']],
            Yii::$app->user->isGuest ? '' : ['label' => '微信配置', 'url' => ['/admin/wechat/index']],
            // Yii::$app->user->isGuest ? '' : ['label' => '图文消息', 'url' => ['/admin/material/list-img-articles']],
            // Yii::$app->user->isGuest ? '' : ['label' => '二维码', 'url' => ['/admin/qrcode/index']],
            Yii::$app->user->isGuest ? '' : ['label' => 'Tenant', 'url' => ['/admin/tenant/index']],
            // Yii::$app->user->isGuest ? '' : ['label' => '数据库', 'url' => ['/admin/install/index']],
            Yii::$app->user->isGuest ? '' : ['label' => '日记', 'url' => ['/admin/log/index']],
            // Yii::$app->user->isGuest ? '' : ['label' => 'Campaign', 'url' => ['/admin/campaign/index']],
            // Yii::$app->user->isGuest ? '' : ['label' => '评论', 'url' => ['/admin/comments/index']],
            // Yii::$app->user->isGuest ? (
            //     ['label' => '注册', 'url' => ['/admin/default/register']]
            // ) : (
            //     ''
            // ),
            Yii::$app->user->isGuest ? (
                ['label' => '登录', 'url' => ['/admin/default/login']]
            ) : (
                '<li>'
                . Html::beginForm(['/admin/default/logout'], 'post')
                . Html::submitButton(
                    '注销 (' . Yii::$app->user->identity->username . ')',
                    ['class' => 'btn btn-link logout']
                )
                . Html::endForm()
                . '</li>'
            )
        ],
    ]);
    NavBar::end();
    ?>

    <div class="container">
        <?= Breadcrumbs::widget([
            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        ]) ?>
        <?= Alert::widget() ?>
        <?= $content ?>
    </div>
</div>

<footer class="footer">
<div class="container">
    <p class="pull-left">&copy; Wechat Member Center <?= date('Y') ?></p>
    <p class="pull-right">技术支持 XGATE Chengdu Co.Ltd </p>
</div>
</footer>

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
